import React from 'react';
import { Badge } from 'antd-mobile';

import AvatarImage from '../AvatarImage';

import './style.scss';

class ChatAvatar extends React.PureComponent {

  render() {
    const { avatar, type, name } = this.props;
    const defaultImageTextProps = {
      [type === 'group' ? 'groupName' : 'userName']: name
    };

    return (
      <div className="chatAvatarContainer">
        <Badge dot>
          <AvatarImage {...defaultImageTextProps} src={avatar} alt="头像" width={45} height={45} />
        </Badge>
      </div>
    )
  }
}

export default ChatAvatar;


